package com.ln.service;

import java.io.Serializable;

import com.ln.dao.IBaseDAO;
import com.ln.dto.ParamsMap;
import com.ln.dto.ResultList;
import com.ln.dto.ResultObj;
import com.ln.pojo.BasePOJO;

public abstract class BaseService<T extends BasePOJO, PK extends Serializable>
		implements IBaseService<T, PK> {
	
	protected abstract IBaseDAO<T, PK> getDao();
	
	@Override
	public int count(final ParamsMap paramsMap) {
		return getDao().count(paramsMap);
	}

	public final ResultObj find(final PK id) {
		return getDao().find(id);
	}
	
	public final T selectOne(final PK id) {
		return getDao().selectOne(id);
	}

	public final ResultList find(final ParamsMap paramsMap) {
		return getDao().find(paramsMap);
	}

	public int update(final T pojo) {
		return getDao().update(pojo);
	}

	public int insert(final T pojo) {
		return getDao().insert(pojo);
	}

	public int delete(PK id) {
		return getDao().delete(id);
	}
	
	public int deleteByObj(T pojo) {
		return getDao().deleteByObj(pojo);
	}
}
